<!DOCTYPE html>
<html>
<head>
<meta name="Keywords" content="your, keywords" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Distribution" content="Global" />
<meta name="Author" content="Erwin Aligam - ealigam@gmail.com" />
<meta name="Robots" content="index,follow" />
<link rel="stylesheet" href="__PUBLIC__/Css/Envision.css" type="text/css" />
<js file="__PUBLIC__/Js/jquery-1.7.2.min.js" />
<title>Envision</title>	
<script type="text/javascript">
	function subForm(){
		var pId = $('#pId').val();
		var name = $('#dname').val();
		var email = $('#demail').val();
		var web = $('#dweb').val();
		var content = $('#dcontent').val();
		$.ajax({
				type: "POST",
				url: "{:U(GROUP_NAME . '/Comment/add')}",
				cache: false,
				dataType:"json",
				data: {'pId':pId,'name':name,'email':email,'web':web,'content':content},
				beforeSend:function(XMLHttpRequest)
				{
					if(pId == 0){
						alert('access denied！');
                        return false;
					}
                    if (name.length == 0) {
                    	alert('请输入姓名！');
                        return false;
                    }
                    if (email.length == 0) {
                    	alert('请输入邮件地址！');
                        return false;
                    }
                    if (content.length == 0) {
                    	alert('请输入评论！');
                        return false;
                    }
                },
				success: function(result){
                    if (result['status'] == 200) {
                        alert(result['info']);
                    } else {
                        alert(result['info']);
                    }
				},
				error: function(){
					alert('请求服务器失败');
				}
			});
	}
</script>
</head>
<body>
<!-- wrap starts here -->
<div id="wrap">
		<include file="Public:header"/>
		<include file="Public:nav"/>
			
		<!-- content-wrap starts here -->
		<div id="content-wrap">
				
		<include file="Public:sidebar"/>
				
			<div id="main">
				
					<div class="post-list">
						<a name="{$post.title}"></a>
						<h2><a href="{:U(GROUP_NAME . '/Show/index')}">{$post.title}</a></h2>
						<div class="post_content">
		                	{$post.content|rePost}
						</div>
						<div class="post-footer align-right">		
							<span class="yuedu">{$post.click}&nbsp;点击</span>
							<span class="date">{$post.add_time|date='Y-m-d',###}</span>		
							<span>by yuzhityuan</span>	
						</div>
					</div>
				


				<div class='msg-board'>
					<a name="comment"></a>
					<h3>留言</h3>
					<div>
						<foreach name="comments" item="cmt">
							<div>
								{$cmt.nickname}{$cmt.content}{$cmt.add_time}
							</div>
						</foreach>
					</div>
					<form id="cmtForm"  method="post">			
					<p>			
					<label>姓名<span style="font-size:12px;">(*)</span></label>
					<input name="dname" id="dname" value="" type="text" size="30" />
					<label>邮箱<span style="font-size:12px;">(*)</span></label>					
					<input name="demail" value="" id="demail" type="text" size="30" />
					<label>网站</label>
					<input name="dweb"  id="dweb" value="" type="text" size="30" />
					<label>评论<span style="font-size:12px;">(*)</span></label>
					<textarea rows="5" cols="5" name="dconent" id="dcontent"></textarea>
					<br />	
					<input type="hidden" name="pId" id="pId" value="{$post.id}" />
					<input class="button" type="button" value="提交" onclick="subForm();"/>		
					</p>		
					</form>				
					<br />	

				</div>
		
		<!-- content-wrap ends here -->	
		</div>
		</div>
		<include file="Public:footer"/>

<!-- wrap ends here -->
</div>

</body>
</html>
